
<template>
  <div class="wrap">
    <video v-if="isShow" id="myVideo" :autoplay="true" :controls="false" :enable-progress-gesture="false" :show-center-play-btn="false" :src="src" :style="{width:windowWidth+'px',height:windowHeight+'px'}" class="video" object-fit="cvoer"></video>
  </div>
</template>

<script>
export default {
  data() {
    return {
      src: "",
      isShow: false,
      info: {},
      windowWidth: uni.getSystemInfoSync().screenWidth,
      windowHeight: uni.getSystemInfoSync().screenHeight,
    };
  },

  onShow() {
    this.isShow = true;
    uni.getStorage({
      key: "pullurl",
      success: res => {
        this.src = res.data;
        console.log(this.src);
      }
    });

  },

  onLoad() {
    this.getAliveinformation();
    uni.$emit('baseUrl', {
      baseUrl: this.$baseUrl,
    });
  },

  onHide() {
    this.isShow = false;
  },

  methods: {
    getAliveinformation() {
      this.$http
          .getAliveinformation({
            shop_id: uni.getStorageSync("shopid")
          })
          .then(res => {
            console.log(res);
            if (res.status === 200) {
              this.info = res.data;
            }
          });
    },

    // onErrorHandle(e) {
    //   this.$Dialog
    //     .confirm({
    //       title: "Wosmart",
    //       cancelButtonText: "退出房间",
    //       message: `开播时间${this.info.start_time}-${this.info.end_time}`,
    //       confirmButtonText: "重新连接"
    //     })
    //     .then(() => {
    //       this.isShow = false;
    //       this.$nextTick(() => {
    //         this.isShow = true;
    //       });
    //     })
    //     .catch(() => {
    //       this.getback();
    //     });
    // },

  }
};
</script>
